<template>
    <div class="bg-white mt-[10px]">
        <BaseHead> 依托项目列表</BaseHead>
        <div class="p-[10px] w-10/12 mx-auto">
            <el-table :data="projectTable" border style="width: 100%">
                <el-table-column prop="name" label="项目名称" />
                <el-table-column prop="chargerName" label="负责人" />
                <el-table-column prop="unitId" label="所属单位" :formatter="formatssdwId" />
                <el-table-column prop="authorizeDate" label="签订日期" />
                <el-table-column prop="feeAuthorize" label="项目经费（万元）" :formatter="formatfeeAuthorize" />
                <el-table-column prop="allMember" label="所有成员 " />
            </el-table>
        </div>
    </div>
</template>
<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import { getByProductId } from "@/api/achievement/common"
import { getCategory } from "@/api/system/category"
import { turnWanyuan } from "@/utils/money.js"
const props = defineProps({
    productId: String,
})
const projectTable = ref([])
const getprojectTable = async () => {
    let res = await getByProductId(props.productId)
    if (res.code == 200) {
        projectTable.value = res.data
    }
}
const zcgsdwList = ref([])
const getCategoryMet1 = async () => {
    let parms = {
        bizName: "成果归属单位"
    }
    let res = await getCategory(parms)
    if (res.code == 200) {
        zcgsdwList.value = res.data
    }
}
const formatssdwId = (row, column, cellValue, index) => {
    if (zcgsdwList.value.length && cellValue) {
        return zcgsdwList.value.find(item => item.codeColumn == cellValue) ? zcgsdwList.value.find(item => item.codeColumn == cellValue).valueColumn : ''
    } else {
        return ''
    }
}
const formatfeeAuthorize = (row, column, cellValue, index) => {
    if (cellValue) {
        return turnWanyuan(cellValue, 0)
    } else {
        return ''
    }
}

onMounted(() => {
    getprojectTable()
    getCategoryMet1()
})
// 如果状态码为200，则将响应数据赋值给zcgsdwList的value属性
</script>
<style lang="scss" scoped>
:deep(.el-transfer-panel) {
    width: 400px;
    height: 400px;

    .el-transfer-panel__body {
        height: 360px;

        .el-transfer-panel__list {
            height: 100%
        }
    }

}
</style>